package com.mdxl.dao.note;

import com.mdxl.Entity.City;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
public interface CityDao {
    @Select({
            "select * from city where id =#{id}"
    })
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "province_id",property = "privinceId"),
            @Result(column = "city_name",property = "cityName"),
            @Result(column = "description",property = "description")
    })
    City gainCity(@Param("id")int id);

    @Delete({
            "delete from city where id =#{id}"
    })
    int deleteCity(@Param("id")int id);

    @Insert({
            "insert into city(province_id,city_name,description) values(#{privinceId},#{cityName},#{description})"
    })
    int addCity(City city);

    @Update({
            "update city set city_name =#{cityName},description=#{description}"
    })
    int updateCity(City city);

}
